<template>
  <div>
    <van-nav-bar
      title="设置"
      left-arrow
      @click-left="onClickLeft"
    />
    <div>
      <van-cell
        title="头像与个人信息"
        is-link
        to="/personinfo"
      />
      <van-cell
        title="常用联系人"
        is-link
        to="/address"
      />
      <van-cell
        title="界面显示"
        is-link
      />
      <van-cell
        title="下载安装"
        is-link
      />
      <van-cell
        title="图片设置"
        is-link
      />
      <van-cell
        title="消息提醒"
        is-link
      />
      <van-cell
        title="隐私设置"
        is-link
      />
      <van-cell
        title="实验室"
        is-link
      />
      <van-cell
        title="缓存清理"
        is-link
      />
      <van-cell
        title="帮助与反馈"
        is-link
      />
      <van-cell
        title="用户协议"
        is-link
      />
      <van-cell
        title="隐私政策"
        is-link
      />
      <van-cell
        title="安全条款"
        is-link
      />
      <van-cell
        title="关于"
        is-link
      />
      <van-button
        type="default"
        class="btn"
        block
        @click="exit"
      >退出登录</van-button>
    </div>
  </div>
</template>

<script>
export default {
  name: "setting",
  methods: {
    onClickLeft() {
      window.history.go(-1);
    },
    // 退出登录
    exit() {
      this.$dialog
        .confirm({
          message: "你确定要退出登录吗？",
        })
        .then(() => {
          sessionStorage.removeItem("user");
          this.$store.state.user = null;
          this.$router.push("/login");
        })
        .catch(() => {
          // on cancel
        });
    },
  },
};
</script>

<style scoped>
.btn {
  border: 0;
  color: red;
  font-size: 16px;
}
</style>